//
//  AddTableViewCell.m
//  GuoBuGaForIphone
//
//  Created by zhangwo on 16/10/27.
//  Copyright © 2016年 GuoBuGa. All rights reserved.
//

#import "AddTableViewCell.h"

@implementation AddTableViewCell
@synthesize picView = _picView;
@synthesize nameLabel = _nameLabel;
@synthesize addButton = _addButton;
@synthesize data = _data;

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _picView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 15, 25, 25)];
        [_picView setContentMode:UIViewContentModeScaleToFill];
        [self addSubview:_picView];
        
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(65, 0, SWIDTH-130, 60)];
        _nameLabel.font = [UIFont systemFontOfSize:16.0];
        _nameLabel.textColor = [UIColor blackColor];
        [self addSubview:_nameLabel];
        
        _addButton = [[UIButton alloc] initWithFrame:CGRectMake(SWIDTH-30, 20, 15, 15)];
        [_addButton setBackgroundImage:[UIImage imageNamed:@"icon-add-tag-image.png"] forState:UIControlStateNormal];
        [_addButton setBackgroundImage:[UIImage imageNamed:@"icon-home-add.png"] forState:UIControlStateSelected];
        [self addSubview:_addButton];
    }
    return self;
}

- (void)setData:(NSDictionary *)data
{
    _data = data;
    [_picView sd_setImageWithURL:[NSURL URLWithString:[data objectForKey:@"image1"]]];
    [_nameLabel setText:[data objectForKey:@"title"]];
}

@end
